package com.acme.bankapp.domain.bank;

import java.util.ArrayList;
import java.util.List;

public class Client {
    List<Account> accounts;
    String name;
    Gender gender;


    public Client() {
        accounts = new ArrayList<Account>();
    }

    public Client(String name, Gender gender) {
        this();
        this.gender = gender;
        this.name = name;
    }

    public List<Account> getAccounts() {
        return accounts;
    }

    public void addAccount(Account acc) {
        this.accounts.add(acc);
    }

    private String getClientSalutation() {
        if (gender != null && name != null) {
            return gender + " " + name;
        } else {
            return "";
        }
    }

    public String toString() {
        String salutation = getClientSalutation();
        if (salutation.equals("")) {
            return super.toString();
        } else {
            return salutation;
        }
    }


}
